home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / CREAT.C < prev    next >
Text File  |  1991-08-05  |  421b  |  17 lines

  1. /* creat.c --- p 488 */
  2. #include <stdio.h>
  3. #include <sys\types.h>
  4. #include <sys\stat.h>
  5. #include <io.h>
  6. main()
  7. {
  8.     int handle;
  9.     unsigned char filename[81];
  10.                         /* Ask user for file name */
  11.     printf("Enter name of file to be created: ");
  12.     gets(filename);
  13.     if ( (handle = creat(filename, S_IREAD | S_IWRITE)) == -1)
  14.         perror("Error creating file!");
  15.     else
  16.         printf("\nFile %s created\n", filename);
  17. }